//
//  AllDynamicVC.swift
//  QQZone
//
//  Created by xmg on 16/9/2.
//  Copyright © 2016年 wlis. All rights reserved.
//

import UIKit

class AllDynamicVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        /** 设置titleView */
        let items = ["全部","特别关心","好友动态","认证空间"]
        let sc = UISegmentedControl(items: items)
        /** 设置颜色 */
        sc.tintColor = UIColor.lightGrayColor()
        /** 设置选中 */
        sc.selectedSegmentIndex = 0
       
        let attrs = [NSForegroundColorAttributeName : UIColor.blackColor()]
        sc.setTitleTextAttributes(attrs, forState: .Normal)
        sc.addTarget(self, action: "scClick:", forControlEvents: .ValueChanged)
        navigationItem.titleView = sc
    }
    @objc private func scClick(sc : UISegmentedControl){
        print(sc.selectedSegmentIndex);
    }
}
